/*
 * @Author: juneChen && junechen_0606@163.com
 * @Date: 2023-06-02 15:45:53
 * @LastEditors: juneChen && juneswoole@163.com
 * @LastEditTime: 2023-09-19 15:13:49
 * @Description: 资源池 数据字典
 * 
 */

export default {
    namespaced: true,
    state: {
        // 运营商字典
        ispDict: [
            {
                value: 'CTCC',
                label: "电信",
            },
            {
                value: 'CUCC',
                label: "联通",
            },
            {
                value: 'CMCC',
                label: "移动",
            },
            {
                value: 'INT',
                label: "国际",
            },
        ], 
        nodeType:[
            {
                value: 'Residence',
                label: "住宅",
                color: 'green'
            },
            {
                value: 'Static',
                label: "静态",
                color: 'blue'
            }
        ],
        // 可购买时间段字典
        timeSlotDict: [
            {
                value: 'day',
                label: "1天",
            },
            {
                value: 'week',
                label: "7天",
            },
            {
                value: 'month',
                label: "1个月",
            },
            {
                value: 'quarter',
                label: "3个月",
            },
            {
                value: 'half_year',
                label: "6个月",
            },
            {
                value: 'year',
                label: "12个月",
            },
        ], 
        //状态 
        statusDict:[
            {
                value: 'Available',
                label: "正常",
                color: 'green'
            },
            {
                value: 'Abnormal',
                label: "异常",
                color: 'orange'
            },
            {
                value: 'Forbidden',
                label: "禁用",
                color: 'red'
            }
        ],
        // 产品
        products: [
            {
                value: 'proxyIp',
                label: "代理IP",
            }
        ],
        // 代理IP操作
        proxyIpOperation: [
            {
                value: 'Purchase',
                label: "购买",
            },
            {
                value: 'Update',
                label: "更新",
            },
            {
                value: 'Renew',
                label: "续费",
            },
            {
                value: 'ChangeIP',
                label: "切换IP",
            },
            {
                value: 'ChangeNode',
                label: "切换节点",
            },
            {
                value: 'ChangeProject',
                label: "切换项目",
            },
            {
                value: 'Delete',
                label: "删除",
            }
        ],
    },
    getters: {
        resourceStateLabel : (state) => (name,value) => {
            var label = "";
            state[name].forEach(element => {
                if(element.value == value){
                    label = element.label;
                }
            });
            return label;
        }
    }
}